import style from "./style.module.css";
import {Props,State} from "./model";
import { Component } from "react";
import { MyInput } from "./styled";
export default class TitleInput extends Component<Props,State>{



    
    render = () => {     
        const {title,placeHold,isImportant,value,type,name,setInputValue}=this.props;
        return (
            <div className={style.TitleInput}>
                <div className={style.title}>
                   { isImportant ? <span style={{color:"red"}}>*</span> : "" } {title}
                </div>
                <div className={style.input}>
                    {
                       (()=>{
                        switch (type) {
                            case "textarea":
                                return <MyInput.TextArea style={{
                                    height:"20vw"
                                }} defaultValue={value} placeholder={placeHold}  />
                        
                        
                            default:
                                return <MyInput  onChange={(e:any)=>{
                                    setInputValue(e.target.value)
                                    switch (type) {
                                        case "":
                                            
                                            break;
                                    
                                        default:
                                            break;
                                    }
                                }} defaultValue={value} type={type} placeholder={placeHold}  />
                        }
                       })()
                    }
                    
                </div>
            </div>
        )
    }
}